home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / tpstat.exe / STAT.DOC < prev    next >
Text File  |  1990-08-08  |  43KB  |  1,382 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.                        Libraries of Elementary 
  7.                      Statistical and Mathematical
  8.                             Subprograms
  9.                                 for
  10.                       Turbo Pascal Version 5.X
  11.  
  12.  
  13.                             Version 1.0
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.                                by
  23.  
  24.                          Norton Associates
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.                         506 Post Oak Dr.
  45.                         Baytown Tx. 77520
  46.  
  47.                       Compuserve 70441,1337
  48. SUMMARY OF FEATURES
  49.  
  50. Version 1.0 of this software contains 30 elementary statistical and 19 
  51. mathematical subprograms.  The MATH Unit was designed to add the 
  52. FORTRAN-77 intrinsic math functions, except for complex math, that are 
  53. not provided by Turbo Pascal Version 5.X.  However, some additional 
  54. math functions have been added to the MATH Unit as appropriate.
  55.  
  56. STAT Unit
  57.  
  58.            - Uniform and normal random number generators
  59.            - 4 different types mean
  60.            - Summary Statistics ( first four moments, etc ) 
  61.            - Percentiles and quartiles
  62.            - Standard errors of parameters for normal distributions
  63.            - Cumulative frequency normal distribution statistics
  64.            - Integral frequency normal distribution statistics
  65.            - Correlation ( product moment and auto lag)
  66.            - Regression ( polynomial and multiple variable )
  67.            - Smoothing ( binomial, moving average and curvilinear )
  68.            - Sorting ( insert and quick )
  69.            - Other tools ( determinant and remove average )
  70.  
  71. MATH Unit
  72.  
  73.            - Radian to degree conversion
  74.            - Normal trigonometric functions ( tan, secant etc )
  75.            - Inverse trigonometric functions  ( atan2, arcsin etc )
  76.            - Hyperbolic functions ( sinh, cosh, tanh )
  77.            - Logarithmic functions ( power, log to any base etc )
  78.            - Other functions (factorial and root of an equation )
  79.  
  80. POSSIBLE FUTURE ENHANCEMENTS
  81.  
  82.            - Cross lag correlation ( two variable)
  83.            - Increase variety of standard errors
  84.            - Contour plotting program
  85.            - Spline smoothing functions
  86.            - Integration
  87.            - Error functions
  88.            - Interpolation and extrapolation
  89.            - Gamma and Bessel functions
  90.            - Graphics ( plot function )
  91.            - Better use of 8087 coprocessor ( i.e., use 8087 tan 
  92.                 function
  93.            - Arrays larger than 16380 single precision elements.  Have 
  94.              created a single dimension array containing 130000 
  95.              elements not 16380 as currently implemented.
  96.            - Complex Math functions
  97. 1.0 Introduction
  98.  
  99. 1.1 Background
  100.  
  101. The statistical programs contained in the STAT Unit were originally 
  102. developed in FORTRAN over the years.  With the advent of a good Pascal 
  103. environment, the use and need of FORTRAN to statistically crunch data 
  104. have diminished drastically. 
  105.   
  106. The MATH Unit was developed because the language of Pascal does not 
  107. contain all the intrinsic math functions as those contained in the 
  108. standard FORTRAN-77 intrinsic function library [6].  The combination 
  109. of Turbo Pascal's math functions and those contained in this MATH Unit 
  110. provides the same functionality as those contained in the FORTRAN-77 
  111. intrinsic function library, except for complex math.
  112.  
  113. The user of these libraries are assumed to be familiar with 
  114. statistics.  The definitions of terms used in these libraries can be 
  115. found by reviewing the reference contained in Section 5.0.  Additional 
  116. statistical and mathematical tools will be added in the future.  
  117.  
  118. This is a shareware product.  Register your copy of the STAT and MATH 
  119. libraries by reading the README.DOC file contained with this 
  120. disk(ette) and sending in the nominal $35 to register the software.  
  121.  
  122.  
  123. 1.2 Converting the Statistical Unit to Turbo Pascal
  124.  
  125. Several things happened while converting the statistical software from 
  126. FORTRAN to Pascal.  
  127.  
  128. First, the size of the arrays - With the the advent of Personal 
  129. Computers (PC's), many mainframe FORTRAN programs have been converted 
  130. to PC's.  In most cases special care had to be taken when the size of 
  131. the arrays multiplied by the size of the element exceeded 64k (65520 
  132. bytes).  This limitation was due to the 8086 segmented architecture. 
  133. Most FORTRAN vendors implemented a way around the 8086 segmented 
  134. architecture.  Well, Turbo Pascal has no provided such a capability 
  135. [1].  The segmented architecture of the 8086 family basically limits 
  136. the size of an array.  The below table explains the size of the 
  137. element and the number of elements in the 65k 8086 architecture 
  138. boundary.
  139.  
  140.                        Table 1. 
  141.  
  142. Element     Size      Maximum number of       
  143. type       (bytes)    elements in array       STAT types
  144. -------    --------   ------------------  ----------------------
  145. Single        4         16380             single_array_pointer
  146. Longint       4         16380             longint_array_pointer
  147.  
  148. For example, this table states that the maximum number of elements 
  149. (indices of the array) of a single precision array is 16380 elements 
  150. in a 65K segment.  This is satisfactory for most applications.  
  151. However, for some applications a vast increase in the number of 
  152. elements in the array was needed.  To make a long story short, I have 
  153. developed a single precision array which which contains 130000 
  154. elements in the array.  This implies that the memory requirements for 
  155. this array size alone is 520000 bytes.  I have not completed testing 
  156. of this version of the software.
  157.  
  158. Second, the 640k DOS limitation - There are two major issues.  How can 
  159. a user make best use of the 640k DOS limitation and if the user needed 
  160. more memory could he/she use extended/expanded memory for array 
  161. storage?  The latter issue is not addressed in this version of the 
  162. software.  The former issue was challenging enough.
  163.  
  164. With a fixed size of DOS, the number of arrays and the number of 
  165. elements in the arrays is very finite.  Not knowing the number of 
  166. elements required by each user dictated that the STAT unit use the 
  167. maximum number of elements from Table 1.  If the arrays were 
  168. statically created this meant that only 9 arrays of 65k bytes could 
  169. ever be created.  This was totally not satisfactory.  The solution was 
  170. to dynamically create the arrays on the heap.  The user could then 
  171. have the best of both worlds.  Basically, heap is the part of memory 
  172. between the top of the application in memory and the 640k DOS 
  173. limitation.  By dynamically creating the arrays, the number of arrays 
  174. in the application is now very large and the size of each array may be 
  175. up to the full 65k limit.  More information on this subject is 
  176. contained in the next section.
  177.  
  178. Finally, the precision - To make the STAT unit more precise, all 
  179. normally double precision numbers are in extended precision.  By 
  180. adding two more bytes per variable, the number of significant digits 
  181. increased by four (15 to 19 digits).
  182.  
  183.  
  184. 1.3 User's Guide to the STAT and MATH Units
  185.  
  186.  
  187. 1.3.1 Format for the Libraries in Sections 3.0 and 4.0
  188.  
  189. A standard format for presenting the subprograms contained in the 
  190. libraries have been developed for Sections 3.0 and 4.0.  An outline of 
  191. the standard format is presented directly below.
  192.  
  193. Name of subprogram here
  194.  
  195. Purpose:   A short purpose statement goes here
  196.  
  197. Interface: The Turbo Pascal Unit Interface
  198.  
  199. Errors:    Any errors are reported here
  200.  
  201. Remarks:   Any special considerations go here
  202.  
  203. Example:   Sample code go here
  204.  
  205.  
  206. 1.3.2  STAT Unit
  207.  
  208. To prevent any unforeseen problems, a series of STAT Unit procedures 
  209. have been developed to dynamically create and delete arrays.  These 
  210. procedures are listed below.
  211.  
  212.  
  213.                     Table 2.
  214.  
  215.                           Procedures for 
  216. Element      Dynamic Creation and Deletion Procedures
  217. Type               Create              Delete
  218. ---------    -------------------  -------------------
  219. Single       create_single_array  delete_single_array
  220. Longint